<?php
//loger(array('loguser'=>'admin','logaction'=>$action,'logtable'=>'source','logcontent'=>$id.':'.$sourcename));
if (!function_exists('loger')) {
	function loger($arguments=array()){
		global $db;
		/*
		var $mytable;
		var $loguser;
		var $logaction;
		var $logtable;
		var $logtime;
		var $logip;
		var $logcontent;
		*/	
		if(!is_array($arguments)){
			trigger_error('The argument is not a array',E_USER_ERROR);
			return;
		}
		if(empty($arguments[loguser])){
			trigger_error('The argument[loguser] is not exist',E_USER_ERROR);
			return;
		}else $loguser=$arguments[loguser];
		
		if(empty($arguments[logaction])){
			trigger_error('The argument[logaction] is not exist',E_USER_ERROR);
			return;
		}else $logaction=$arguments[logaction];
		
		if(empty($arguments[logtable])){
			trigger_error('The argument[logtable] is not exist',E_USER_ERROR);
			return;
		}else $logtable=$arguments[logtable];
		
		if(empty($arguments[logcontent])){
			trigger_error('The argument[logcontent] is not exist',E_USER_ERROR);
			return;
		}else $logcontent=$arguments[logcontent];
		
		$mytable='log';
		$logtime=date("Y-m-d H:i:s");
		$logip=getIp();//include('function.inc.php');
		
		$sql="insert into ".$mytable." (loguser,logaction,logtable,logtime,logip,logcontent) values('$loguser','$logaction','$logtable','$logtime','$logip','$logcontent')";
		$db->insert($sql);
	}
}
?>